import yaml
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from pathlib import Path


cfg = '/home/zhangbin/code/yoloair/configs/yolov5/yolov5s6.yaml'
with open(cfg, encoding='ascii', errors='ignore') as f:
    cfg_yaml = yaml.safe_load(f)

anchors = cfg_yaml.get('anchors')

# # lf = one_cycle(1, hyp['lrf'], epochs)
# # lf = lambda x: (1 - x / epochs) * (1.0 - hyp['lrf']) + hyp['lrf']
# y1 = 1
# y2 = 0.1
# steps = 200
# epochs = 200
# x = np.arange(epochs)
# y_ = lambda x_: ((1 - np.cos(x_ * np.pi / steps)) / 2) * (y2 - y1) + y1
# lf = lambda x_: (1 - x_ / epochs) * (1.0 - y2) + y2
# # y = y_(x)
# y = lf(x)
# plt.plot(y)
# plt.show()

# a = Path(cfg).parent.with_suffix('.abc')
# print(a)

lb = np.array([[2, 0.6, 0.5, 0.3, 0.4], [6, 0.6, 0.5, 0.3, 0.4]])
v, i = np.unique(lb, axis=0, return_index=True)

path = Path('/home/zhangbin/code/yoloair/configs/yolov5/yolov5s6.yaml')
pass
